![]() |
![]() |
![]() |
|
Numerical bases are the method by which a value is represented. Most number systems use Base 10 which essentially consists of digits zero through nine. This however is not the only method of representing a value. There are many other forms of numerical representation, some of which are supported below. BINARYnumerical value representing Base 2 and consists only of values zero and one. Counting from zero through to ten, the binary values would look like 0, 01, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010. A binary value is coded with a "%" symbol prefix to inform the compiler that the value is binary. In binary, the value ten would be coded %1010. OCTALnumerical value representing Base 8 and consists of values zero through seven. Counting from zero through to ten, the octal values would look like 00, 01, 02, 03, 04, 05, 06, 07, 10, 11, 12. An octal value is coded with a "0c" prefix to inform the compiler that the value is octal. In octal, the value ten would be coded 0c12. HEXADECIMALnumerical value representing Base 16 and consists of values 0 through F. Counting from zero through to twenty, the hexadecimal values would look like 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 0A, 0B, 0C, 0D, 0E, 0F, 10, 11, 12, 13, 14. A hexadecimal value is coded with a "0x" prefix to inform the compiler that the value is hex. In hexadecimal, the value twenty would be coded 0x14. Be aware that hexidecimal, binary and octal literals are limited to 32-bit values. In order to assign non-base-10 literals to a 64-bit double variable, you must apply an addition or multiplication to assign the value. Literals are only defined as integer, float or string. If you wish to perform maths on other data types such as double integer or double float, you must store your literal values inside a variable of the desired type. For example instead of the code X AS DOUBLE INTEGER : X=10^10 you must code X AS DOUBLE INTEGER : A AS DOUBLE INTEGER : A=10 : X=A^A When assigning a literal value to a variable in one command such as GLOBAL VAR = 42, this is acceptable. You cannot however feed a value from an expression to initialise a variable in this way. Instead break the code apart, such as GLOBAL VAR : VAR=RGB(0,0,0) |